/**
 * 
 */
package com.onlinemathuracrud.model;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.springframework.web.multipart.MultipartFile;



/**
 * @author Amit Kashyap
 *
 */

@Entity
@Table(name="temple")
@AttributeOverride( name="id", column = @Column(name="temple_id") )
//@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class Temple extends ReligiousItem{

	private static final long serialVersionUID = -5276959089537331046L;

	@OneToOne(cascade = CascadeType.ALL , fetch = FetchType.EAGER)
    @JoinColumn(name = "timing_id", referencedColumnName = "id")
	@ForeignKey(name = "fk_timing_id")
	private Timing timing;
	
	
	@OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//	@ForeignKey(name="fk_temple_id" , inverseName="fk_image_id")
	@JoinTable(name = "temple_image", joinColumns = { @JoinColumn(name = "temple_id")}, inverseJoinColumns = { @JoinColumn(name = "image_id") })
	private Set<Image> templeImages = new HashSet<Image>(0);

	
	@OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//	@ForeignKey(name="fk_temple_id" , inverseName="fk_video_id")
	@JoinTable(name = "temple_video", joinColumns = { @JoinColumn(name = "temple_id")}, inverseJoinColumns = { @JoinColumn(name = "video_id") })
	private Set<Video> templeVideos = new HashSet<Video>(0);

	@OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY)
//	@ForeignKey(name="fk_temple_id" , inverseName="fk_routemap_id")
	@JoinTable(name = "temple_routemap", joinColumns = { @JoinColumn(name = "temple_id")}, inverseJoinColumns = { @JoinColumn(name = "routemap_id") })
	private Set<RouteMap> templeRouteMaps = new HashSet<RouteMap>(0);

	
	@Transient
	private List<MultipartFile> imageFiles;

	public List<MultipartFile> getImageFiles() {
		return imageFiles;
	}

	public void setImageFiles(List<MultipartFile> imageFiles) {
		this.imageFiles = imageFiles;
	}
	
	
	
	/**
	 * @return the timing
	 */
	public Timing getTiming() {
		return timing;
	}

	/**
	 * @param timing the timing to set
	 */
	public void setTiming(Timing timing) {
		this.timing = timing;
	}

	/**
	 * @return the templeImages
	 */
	public Set<Image> getTempleImages() {
		return templeImages;
	}

	/**
	 * @param templeImages the templeImages to set
	 */
	public void setTempleImages(Set<Image> templeImages) {
		this.templeImages = templeImages;
	}

	/**
	 * @return the templeVideos
	 */
	public Set<Video> getTempleVideos() {
		return templeVideos;
	}

	/**
	 * @param templeVideos the templeVideos to set
	 */
	public void setTempleVideos(Set<Video> templeVideos) {
		this.templeVideos = templeVideos;
	}

	/**
	 * @return the templeRouteMaps
	 */
	public Set<RouteMap> getTempleRouteMaps() {
		return templeRouteMaps;
	}

	/**
	 * @param templeRouteMaps the templeRouteMaps to set
	 */
	public void setTempleRouteMaps(Set<RouteMap> templeRouteMaps) {
		this.templeRouteMaps = templeRouteMaps;
	}
	
}
